package com.wnxy.admin.common.handler;

import com.wnxy.admin.common.ResponseResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
*  统一异常处理类
* */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    public ResponseResult handlerBusinessException(BusinessException be) {
        return ResponseResult.fail(be.getIErrorCode());
    }

    @ExceptionHandler(Exception.class)
    public ResponseResult handlerException(Exception e) {
        e.printStackTrace();
        return ResponseResult.fail(SysBusinessEnum.SYS_BUSY);
    }
}
